<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Skornyakov Anatoliy
 * Date: 15.06.13
 * Time: 16:09
 * 
 */

$this->headLink()->appendStylesheet('http://ajax.googleapis.com/ajax/libs/dojo/1.7/dijit/themes/tundra/tundra.css');
$this->headScript()->setAllowArbitraryAttributes(true)->appendFile('http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/dojo.js', 'text/javascript', array('data-dojo-config' => 'parseOnLoad: true, isDebug: true, locale: "ru-ru"'));
?>

<?php $this->headScript()->captureStart() ?>
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.form.Select");

dojo.ready(function () {
    var cityStore = new dojo.data.ItemFileReadStore({url: "/index/get-city-list?format=json"});

    selectCity.setStore(cityStore);

    dojo.connect(selectCity, 'onChange', function (cityId) {
        var metroStore = new dojo.data.ItemFileReadStore({url: "/index/get-metro-list/cityId/" + cityId + "?format=json"});
        selectMetro.setStore(metroStore);
    })
});
<?php $this->headScript()->captureEnd() ?>

<?php echo $this->fMetro ?>

